#ifndef _USARTFRAME_STM32_H___
#define _USARTFRAME_STM32_H___

#include "stm32f4xx.h"

#pragma pack (4)

#define FRAME_DATA_SUM  16  //4的整数
typedef struct
{
	unsigned char  SOF;//帧头
	unsigned char  MOD;//(4 - (数据长度%4))
	unsigned short LEN;//数据长度
	unsigned int   CRC32;//CRC32校验码
	unsigned char  DATA[FRAME_DATA_SUM];//数据BUF
}FRAME;

void UsartFrameInit(void);
uint32_t CRC_STM32Hard(uint8_t* pBuffer, uint32_t BufferLength);
uint32_t CRC_STM32Check(uint8_t* pBuffer, uint32_t BufferLength , uint32_t CRC32Rec);
void UsartFrameSend(FRAME * pBuffer);
unsigned char UsartFrameRec(unsigned char * str);

#endif

